﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe xmlns="http://schemas.microsoft.com/pag/gax-core"
        xmlns:xi="http://www.w3.org/2001/XInclude">
	<Arguments>
		<Argument Name="EntLibPath" Required="false">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.OS.LocalMachineEntryProvider, Microsoft.Practices.RecipeFramework.Extensions"
					RegistryPath="Software\Microsoft\patterns &amp; practices\Repository Factory" RegistryEntry="EntlibBinaryPath"/>
		</Argument>

    
		<Argument Name="CommonAssembly" Required="false">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.OS.PathCreatorProvider, Microsoft.Practices.RecipeFramework.Extensions"
							PathArgument="EntLibPath" File="Microsoft.Practices.EnterpriseLibrary.Common.dll" />
		</Argument>
		<Argument Name="DataAssembly" Required="false">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.OS.PathCreatorProvider, Microsoft.Practices.RecipeFramework.Extensions"
							PathArgument="EntLibPath" File="Microsoft.Practices.EnterpriseLibrary.Data.dll" />
		</Argument>
		<Argument Name="GenericRepositoryAssembly" Required="false">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.OS.PathCreatorProvider, Microsoft.Practices.RecipeFramework.Extensions"
							PathArgument="EntLibPath" File="Microsoft.Practices.Repository.dll" />
		</Argument>
		<Argument Name="RegistryHiveExists" Type="System.Boolean">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.General.IsNotNullProvider, Microsoft.Practices.RecipeFramework.Extensions"
					  Argument="EntLibPath" />
		</Argument>
		<Argument Name="HostProject" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
			<Converter
			  Type="Microsoft.Practices.RepositoryFactory.Converters.ProjectWithResponsibilityConverter, Microsoft.Practices.RepositoryFactory"
			  ResponsibilityArgument="IsHostProject"/>
			<ValueProvider Type="Microsoft.Practices.RepositoryFactory.ValueProviders.ProjectsWithResponsibilityProvider, Microsoft.Practices.RepositoryFactory"
						   ResponsibilityArgument="IsHostProject" />
		</Argument>
		<Argument Name="SolutionPathArgument" Type="System.String">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.VisualStudio.SolutionPathProvider, Microsoft.Practices.RecipeFramework.Extensions"></ValueProvider>
		</Argument>
		<Argument Name="SolutionNameArgument" Type="System.String">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.VisualStudio.SolutionNameProvider, Microsoft.Practices.RecipeFramework.Extensions"></ValueProvider>
		</Argument>
		<Argument Name="RecipeState" Type="System.Xml.XmlDocument, System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
			<ValueProvider Type="Microsoft.Practices.RepositoryFactory.ValueProviders.RecipeStateValueProvider , Microsoft.Practices.RepositoryFactory"
						   SolutionPathArgument="SolutionPathArgument"
						   SolutionNameArgument="SolutionNameArgument" />
		</Argument>    
    <Argument Name="InterfacesNamespace">
      <ValueProvider Type="Evaluator" Expression="$(BusinessEntitiesProject.Properties.Item('DefaultNamespace').Value).Interface">
        <MonitorArgument Name="BusinessEntitiesProject" />
      </ValueProvider>
    </Argument>

    <Argument Name="EntityRepositoryInterfaceTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntityRepositoryInterface.vb.t4"/>
    </Argument>
    
    <Argument Name="EntityRepositoryTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntityRepository.vb.t4"/>
    </Argument>

    <Argument Name="EntityFactoryTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntityFactory.vb.t4"/>
    </Argument>

    <Argument Name="EntityDeleteFactoryTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntityDeleteFactory.vb.t4"/>
    </Argument>

    <Argument Name="EntityInsertFactoryTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntityInsertFactory.vb.t4"/>
    </Argument>

    <Argument Name="EntityUpdateFactoryTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntityUpdateFactory.vb.t4"/>
    </Argument>

    <Argument Name="EntitySelectionFactoryTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\EntitySelectionFactory.vb.t4"/>
    </Argument>

    <Argument Name="IdentityTemplate">
      <ValueProvider Type="Evaluator"
        Expression="T4\DAC.VB\Identity.vb.t4"/>
    </Argument>

    <Argument Name="RecipeLanguage">
      <ValueProvider Type="Evaluator" Expression="VB"/>
    </Argument>
  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page Type="Microsoft.Practices.RepositoryFactory.CustomPages.EntitySPMapperCP, Microsoft.Practices.RepositoryFactory"
				  Height="470" Width="550">
          <Title>Mapping properties</Title>
					<LinkTitle>Specify mapping between entities and stored procedures</LinkTitle>
					<Help>Specify the mapping between entities and stored procedures.</Help>
				</Page>
			</Pages>
		</Wizard>
	</GatheringServiceData>
	<Actions CoordinatorServiceType="Microsoft.Practices.RecipeFramework.Extensions.Coordinators.ConditionalCoordinator, Microsoft.Practices.RecipeFramework.Extensions">
		<Action Name="ShowMessage" Type="Microsoft.Practices.RepositoryFactory.Actions.ShowEntLibMessageAction, Microsoft.Practices.RepositoryFactory">
			<Input Name="HiveExists" RecipeArgument="RegistryHiveExists"/>
		</Action>
		<Action Name="AddEntLibCommonReferenceToDataAccessProject" Condition="$(RegistryHiveExists)" Type="Referencer">
			<Input Name="ReferringProject" RecipeArgument="DataAccessProject"/>
			<Input Name="ReferencedAssembly" RecipeArgument="CommonAssembly"/>
		</Action>
		<Action Name="AddEntLibDataReferenceToDataAccessProject" Condition="$(RegistryHiveExists)" Type="Referencer">
			<Input Name="ReferringProject" RecipeArgument="DataAccessProject"/>
			<Input Name="ReferencedAssembly" RecipeArgument="DataAssembly"/>
		</Action>
		<Action Name="AddGenericRepositoryReferenceToDataAccessProject" Condition="$(RegistryHiveExists)" Type="Referencer">
			<Input Name="ReferringProject" RecipeArgument="DataAccessProject"/>
			<Input Name="ReferencedAssembly" RecipeArgument="GenericRepositoryAssembly"/>
		</Action>
		<Action Name="AddReferenceToDataAccessProject" Condition="$(RegistryHiveExists)" Type="Referencer">
			<Input Name="ReferringProject" RecipeArgument="DataAccessProject"/>
			<Input Name="ReferencedProject" RecipeArgument="BusinessEntitiesProject"/>
		</Action>
		<Action
			  Name="GenerateEntityRepositoryInterface" Condition="$(RegistryHiveExists)"
			  Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntityRepositoryInterfaceTemplate"/>
			<Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
			<Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
			<Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
			<Output Name="Content"/>
		</Action>
		<Action Name="AddEntityRepositoryInterface" Condition="$(RegistryHiveExists)"
					  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
					  Open="true"
					  Overwrite="true"
					  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateEntityRepositoryInterface.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
		<!--//Create the folders-->
		<Action Name="CreateEntitiesFolders" Condition="$(RegistryHiveExists)"
			Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.CreateEntitiesFoldersAction, Microsoft.Practices.RepositoryFactory">
			<Input Name="Project" RecipeArgument="DataAccessProject" />
			<Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
			<Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
			<Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
		</Action>
		<!--//end of create the folders-->
		<!--//refactored templates-->
		<Action
			  Name="GenerateEntityRepository" Condition="$(RegistryHiveExists)"
			  Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntityRepositoryTemplate"/>
			<Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
			<Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
			<Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
      <Input Name="InterfacesNamespace" RecipeArgument="InterfacesNamespace" />
			<Output Name="Content"/>
		</Action>
		<Action Name="AddEntityRepository" Condition="$(RegistryHiveExists)"
					  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
					  Open="true"
					  Overwrite="true"
					  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateEntityRepository.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
    <Action	Name="GenerateEntityFactory" Condition="$(RegistryHiveExists)"
			    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntityFactoryTemplate"/>
      <Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
      <Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
      <Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
      <Output Name="Content"/>
    </Action>
		<Action Name="AddEntityFactory" Condition="$(RegistryHiveExists)"
					  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
					  Open="true"
					  Overwrite="true"
					  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateEntityFactory.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
		<Action
			  Name="GenerateDeleteAddFactory" Condition="$(RegistryHiveExists)"
			  Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntityDeleteFactoryTemplate"/>
			<Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
			<Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
			<Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
			<Output Name="Content"/>
		</Action>
		<Action       Name="AddEntityDeleteFactory" Condition="$(RegistryHiveExists)"
					  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
					  Open="true"
					  Overwrite="true"
					  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateDeleteAddFactory.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
    <Action
				Name="GenerateEntityInsertFactory" Condition="$(RegistryHiveExists)"
				Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntityInsertFactoryTemplate"/>
      <Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
      <Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
      <Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
      <Output Name="Content"/>
    </Action>
		<Action
			Name="AddEntityInsertFactory" Condition="$(RegistryHiveExists)"
				  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
				  Open="true"
				  Overwrite="true"
				  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateEntityInsertFactory.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
    <Action
				  Name="GenerateEntityUpdateFactory" Condition="$(RegistryHiveExists)"
				  Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntityUpdateFactoryTemplate"/>
      <Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
      <Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
      <Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
      <Output Name="Content"/>
    </Action>
		<Action
			Name="AddEntityUpdateFactory" Condition="$(RegistryHiveExists)"
				  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
				  Open="true"
				  Overwrite="true"
				  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateEntityUpdateFactory.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
    <Action
			  Name="GenerateEntitySelectionFactory" Condition="$(RegistryHiveExists)"
			  Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="EntitySelectionFactoryTemplate"/>
        <Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
        <Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
        <Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
        <Output Name="Content"/>
      </Action>
		<Action
				Name="AddEntityEntitySelectionFactory" Condition="$(RegistryHiveExists)"
					  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
					  Open="true"
					  Overwrite="true"
					  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateEntitySelectionFactory.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
    <Action
			  Name="GenerateIdentity" Condition="$(RegistryHiveExists)"
			  Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="IdentityTemplate"/>
      <Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
      <Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
      <Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
      <Output Name="Content"/>
    </Action>
		<Action
				Name="AddIdentity" Condition="$(RegistryHiveExists)"
					  Type="Microsoft.Practices.RepositoryFactory.Actions.VisualStudio.SplitAndAddItemsFromStringAction, Microsoft.Practices.RepositoryFactory"
					  Open="true"
					  Overwrite="true"
					  ShowConfirmation="false">
			<Input Name="Content" ActionOutput="GenerateIdentity.Content" />
			<Input Name="Project" RecipeArgument="DataAccessProject" />
		</Action>
		<!--//end refactored templates-->
		
		<Action Name="GetConfiguration" Type="Microsoft.Practices.RepositoryFactory.Actions.Configuration.GetConfigurationAction, Microsoft.Practices.RepositoryFactory">
			<Input Name="Project" RecipeArgument="HostProject" />
			<Output Name="Configuration" />
		</Action>
		<Action Name="SetRepositoryMapping" Type="Microsoft.Practices.RepositoryFactory.Actions.Configuration.SetRepositoryMappingAction, Microsoft.Practices.RepositoryFactory">
			<Input Name="Configuration" ActionOutput="GetConfiguration.Configuration" />
			<Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
			<Input Name="DataAccessProject" RecipeArgument="DataAccessProject" />
			<Input Name="DataAccessClassNamespace" RecipeArgument="DataAccessClassNamespace"/>
			<Input Name="BusinessEntityClassNamespace" RecipeArgument="BusinessEntityClassNamespace"/>
		</Action>
		<Action Name="PersistsRepositoryOperations" Type="Microsoft.Practices.RepositoryFactory.Actions.PersistsRepositoryOperationsAction, Microsoft.Practices.RepositoryFactory">
			<Input Name="Entities" RecipeArgument="EntitiesStoredProcedureMappings"/>
			<Input Name="RecipeState" RecipeArgument="RecipeState"/>
		</Action>
		<Action Name="PersistRepositoryRecipeState" Type="Microsoft.Practices.RepositoryFactory.Actions.PersistRecipeStateAction, Microsoft.Practices.RepositoryFactory">
			<Input Name="RecipeState" RecipeArgument="RecipeState"/>
			<Input Name="SolutionPath" RecipeArgument="SolutionPathArgument"/>
			<Input Name="SolutionName" RecipeArgument="SolutionNameArgument"/>
		</Action>
	</Actions>
</Recipe>